package org.example.model.dto;

import lombok.Data;

/**
 * 商家进件响应结果
 */
@Data
public class MerchantOnboardingResponse {

    /**
     * 响应码
     */
    private String code;

    /**
     * 响应消息
     */
    private String msg;

    /**
     * 子响应码
     */
    private String subCode;

    /**
     * 子响应消息
     */
    private String subMsg;

    /**
     * 申请单号（支付宝返回的唯一标识）
     */
    private String applyId;

    /**
     * 外部业务号
     */
    private String outBizNo;

    /**
     * 审核状态：AUDITING-审核中，AUDIT_PASS-审核通过，AUDIT_REJECT-审核拒绝
     */
    private String auditStatus;

    /**
     * 拒绝原因
     */
    private String rejectReason;

    /**
     * 商户PID（进件成功后支付宝分配的商户ID）
     */
    private String merchantPid;

    /**
     * 是否成功
     */
    private boolean success;

    /**
     * 创建成功响应
     */
    public static MerchantOnboardingResponse success(String applyId, String outBizNo) {
        MerchantOnboardingResponse response = new MerchantOnboardingResponse();
        response.setSuccess(true);
        response.setCode("10000");
        response.setMsg("Success");
        response.setApplyId(applyId);
        response.setOutBizNo(outBizNo);
        return response;
    }

    /**
     * 创建失败响应
     */
    public static MerchantOnboardingResponse failure(String code, String msg, String subCode, String subMsg) {
        MerchantOnboardingResponse response = new MerchantOnboardingResponse();
        response.setSuccess(false);
        response.setCode(code);
        response.setMsg(msg);
        response.setSubCode(subCode);
        response.setSubMsg(subMsg);
        return response;
    }
}
